﻿@using System.Runtime.InteropServices.ComTypes
@using KRM.Core
@using KRM.Core.DataObject
@model KRM.Core.tblUser

@{
    var vWebSelecttblKRMUserPermissions = (List<vWebSelecttblKRMUserPermission>)ViewBag.vWebSelecttblKRMUserPermissions ?? new List<vWebSelecttblKRMUserPermission>();
    var allPermission = (List<ComboboxObject>)ViewBag.allPermission;
    ViewBag.Title = "Edit permission for " + Model.Username;
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
    <script src="~/js/User.js"></script>
    
}
<form class="margin0" action="/users/managerpermission?userID=@Model.UserID" method="POST" ID="manager-permission" >
    <div style="padding: 10px;" class="managepermission">
        <div class="row-fluid">
            <div class="span12">
                @*Permissions Currently Assigned to @Model.Username
                <br />*@
                <div class="row-fluid">
                    <fieldset class="span6">
                        <legend>Currently Permissions</legend>
                        <div class="row-fluid">
                            @*      <img alt="" src="/img/Excel_32.png" width="16" style="float: right;cursor: pointer; padding: 5px;" onclick="ExportManagerPermission(@Model.UserID)" />*@
                            <span style="padding: 0px 20px; float: right;">Select remoke permission </span>
                        </div>
                        <ul class="ullistpermission">
                            @foreach (var item in vWebSelecttblKRMUserPermissions)
                            {
                                <li>
                                    <label>
                                        <input type="checkbox" class="cbcheck" name="curentPermission" value="@item.permissionID" />
                                        @item.permissionName
                                    </label>
                                </li>
                            }
                        </ul>
                    </fieldset>
                    <fieldset class="span6">
                        <legend>Permission List</legend>
                        <label style="display: inline; margin-top: 5px; padding: 4px 0px">
                            <input type="checkbox" class="cbcheck checkall" style="margin-left: 11px;" onchange="ChangeListpermission()" />
                            Check All
                        </label>

                        <div class="clearfix"></div>
                        <ul class="ullistpermission">
                            @foreach (var item in allPermission)
                            {
                                <li>
                                    <label>
                                        <input type="checkbox" class="cbcheck cklistpermission" name="allPermission" value="@item.Id" />
                                        @item.Name
                                    </label>
                                </li>
                            }
                        </ul>
                    </fieldset>
                </div>
            </div>
        </div>
        <div class="border-padding10 text-center">
            @*<input type="button" class="btn btn-success"  onclick="AddUserPermission(@Model.UserID)" value="Add User Permission" />*@
            <input type="submit" name="adduser" class="btn btn-success" value="Add User Permission" />
            <input type="button" name="remoke" class="btn btn-danger" onclick="checkconfirm()" value="Remoke Permission" style="margin: 0 10px" />
            <a href="/users/adduser?userid=@Model.UserID" class="btn w100 btn-info" >Back</a>
        </div>
    </div>
</form>
